import request from '@/utils/request';

// 加载数据
export function load(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/itRoad/load/' + id,
		method: 'get',
	});
}

// 新增或修改节点
export function saveOrUpdateNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/itRoad/saveOrUpdateNode',
		method: 'post',
		params: data,
	});
}

// 删除节点
export function deleteNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/itRoad/deleteNode',
		method: 'delete',
		params: data,
	});
}

// 节点连线
export function linkNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/itRoad/linkNode',
		method: 'post',
		params: data,
	});
}

// 删除连线
export function deleteLink(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/itRoad/deleteLink',
		method: 'post',
		params: data,
	});
}

// 查询端类型
export function querySegmentType() {
	return request({
		url: '/admin/modules/metadata/segment/type/list',
		method: 'post',
	});
}

// 查询协议
export function queryAgreementResource(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/metadata/agreement/resource/list',
		method: 'post',
	});
}
